<?php
define('IN_TG','index');
define('IN_JS','blog');
define('SCRIPT','index');
session_start();
require('includes/common.inc.php');
//加载头部文件
require('header.php');
//统计总数
//分页计算
$size = 10;
//查询所有数据的sql语句
$sql = "select tg_id,tg_title,tg_readcount,tg_commendcount,tg_type from tg_article where tg_reid = 0";

_page($sql,$size);

$sql .= " order by tg_date desc limit $_pagenum,$size";
$res = _query($sql);
?>
<div id="list">
	<h2>帖子列表</h2>
	<a href="post.php" class="post">发表帖子</a>
	<ul class="article">
		<?php while($row = _fetch_array_list($res)):?>
		<li class="icon<?php echo $row['tg_type']?>"><em>阅读数(<strong><?php echo $row['tg_readcount']?></strong>) 评论数(<strong><?php echo $row['tg_commendcount']?></strong>)</em> <a href="article.php?id=<?php echo $row['tg_id']?>"><?php echo $row['tg_title']?></a></li>
		<?php endwhile;?>
	</ul>
	<div id="page_text"><?php _paging(2)?></div>
</div>

<div id="user">
	<h2>新进会员</h2>
	<dl>
		<?php $new_user_row=_get_xml('new.xml');?>
		<dd class="user"><?php echo $new_user_row['username']?>(<?php echo $new_user_row['sex']?>)</dd>
		<dt><img src="<?php echo $new_user_row['face']?>" alt="<?php echo $new_user_row['username']?>" /></dt>
		<dd class="message"><a href="javascript:;" name="message" title="<?php echo $new_user_row['id']?>">发消息</a></dd>
		<dd class="friend"><a href="javascript:;" name="friend" title="<?php echo $new_user_row['id']?>">加为好友</a></dd>
		<dd class="guest">写留言</dd>
		<dd class="flower"><a href="javascript:;" name="flower" title="<?php echo $new_user_row['id']?>">给他送花</a></dd>
		<dd class="email">邮件：<a href="mailto:<?php echo $new_user_row['email']?>"><?php echo $new_user_row['email']?></a></dd>
		<dd class="url">网址：<a target="_blank" href="<?php echo $new_user_row['url']?>"><?php echo $new_user_row['url']?></a></dd>
	</dl>
</div>
<div id="pics">
	<?php $new_photo_row=_get_new_photo();?>
	<h2>最新图片 -- <?php echo $new_photo_row['tg_name'];?></h2>
	<a href="photo_detail.php?id=<?php echo $new_photo_row['tg_id'];?>"><img alt="<?php echo $new_photo_row['tg_name'];?>" src="<?php echo $new_photo_row['tg_url'];?>"></a>
</div>
<?php
require('includes/footer.inc.php');	
?>
